GtkStyleContext: allow late set_path() calls.
authorCarlos Garnacho <carlosg@gnome.org>
Sun, 11 Apr 2010 17:46:57 +0000 (19:46 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:37:00 +0000 (15:37 +0100)
Now the properties will only be regenerated whenever there's a GtkWidgetPath
to query about.

gtk/gtkstylecontext.c

index cb6bab6472eb00a29d9874102f45e3ca0538d455..9bf51e1369cd0b54fb317e81157b03f69a639f3f 100644 (file)
@@ -196,7 +196,8 @@ gtk_style_context_add_provider (GtkStyleContext  *context,
   if (!added)
     priv->providers = g_list_append (priv->providers, new_data);
 
-  rebuild_properties (context);
+  if (priv->widget_path)
+    rebuild_properties (context);
 }
 
 void
@@ -233,7 +234,7 @@ gtk_style_context_remove_provider (GtkStyleContext  *context,
       list = list->next;
     }
 
-  if (removed)
+  if (removed && priv->widget_path)
     rebuild_properties (context);
 }
 
@@ -358,7 +359,10 @@ gtk_style_context_set_path (GtkStyleContext *context,
     }
 
   if (path)
-    priv->widget_path = gtk_widget_path_copy (path);
+    {
+      priv->widget_path = gtk_widget_path_copy (path);
+      rebuild_properties (context);
+    }
 }
 
 G_CONST_RETURN GtkWidgetPath *